<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3.两个块级元素的外边距合并</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }

        .box_one{
            width: 300px;
            height:300px;
            background-color: aqua;
            margin-top: 10px;
            /* overflow: hidden; */

          /* 以下两种方法最好将父元素变为怪异盒子,以防止父盒子的大小发生变化 */
            box-sizing: border-box; 
            border-top: 1px solid gray;
            /* padding-top: 1px; */
        }

        .box_two{
            width: 200px;
            height: 200px;
            background-color: chartreuse;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div class="box_one"> 
        <div class="box_two"> 子</div>
    </div>
    <!-- <div class="box_two">box_two</div> -->
</body>
</html>